<?php
	namespace Qzn\Controller;
	require_once('./View/memberListView.php');
	require_once('./Model/memberListHandler.php');

	class MemberListController {
		
		/**
		 * @param LoginView $lw
		 * @return string $html
		 */
		public function DoControll(\Qzn\Model\LoginHandler $lh, \Qzn\Model\Database $db, \Qzn\View\LoginView $lw) {
			$mlw = new \Qzn\View\MemberListView();
			$mlh = new \Qzn\Model\MemberListHandler($db);
			$html = "";
			
			if ($lh->IsLoggedIn()) {
				if ($mlw->TriedToRemoveMember()) {
					$html .= $mlh->RemoveMember($mlw, $lw);
				}
				
				if ($mlw->TriedToPromoteMember()) {
					$html .= $mlh->PromoteMember($mlw, $lw);
				}
				
				$html .= $mlw->MemberListBox($mlh, $lw);
			}
			
			return $html;
		}
	}
?>